package com.vcar.LDiceClient.chat
{
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import flash.filters.GlowFilter;
	public class ChatLinkObject extends ChatExObject
	{
		private var tf:TextField;
		private var tfm:TextFormat;
		private var linkColor:Number=0x00FFFF;
		private var args:Array;
		public function ChatLinkObject(arg:String)
		{
			// arg="idxxx|namexxx"
			args=arg.split("|");
			
			tfm=new TextFormat();
			tfm.color=linkColor;
			tfm.bold=false;
			
			tf=new TextField();
			tf.selectable=false;
			tf.mouseEnabled=false;
			tf.autoSize=TextFieldAutoSize.LEFT;			
			tf.defaultTextFormat=tfm;
			tf.text="【"+args[1]+"】";
			tf.filters=[new GlowFilter(0,1,3,3,255)];			
			addChild(tf);
			
			buttonMode=true;
			useHandCursor=true;					
			addEventListener(MouseEvent.CLICK,onClick);
		}
		private function onClick(e:MouseEvent):void
		{
			var evt:ChatExObjectEvent=new ChatExObjectEvent(ChatExObjectEvent.CLICK);
				evt.data=args;
				evt.exObject=this;
				evt.targetType="LinkObject";
			dispatchEvent(evt);
		}		
	}
}